package com.study.spmongodb.wwj.juc.utils.complete;

import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;

/**
 * @author MI
 * @version 1.0
 * @date 2020/12/16 22:11
 */
public class CompletableFutureExample3 {

    public static void main(String[] args) throws ExecutionException, InterruptedException {
        final CompletableFuture<String> future = CompletableFuture.supplyAsync(() -> "hello");
        final CompletableFuture<String> done = future.whenComplete((v, t) -> System.out.println("DONE"));
        System.out.println(done.get());
    }
}
